<?php
/*
* Example: SendPushMessage ang Getting Delivery Status of it.
*/

error_reporting(E_ALL);  

// Select only one of this
include_once "../src/wappushRESTlibraryXML.php";
//include_once "../src/wappushRESTlibraryJSON.php";
//include_once "../src/wappushRESTlibraryURLEnc.php";

//$pushClient = new pushRESTclient($spId,$serviceId,$spPassword,$token,$requestor_id,$apiendpoint);
$pushClient = new pushRESTclient("000154","0102129606","123456","o3H85j7c3","525514009846","https://200.39.21.12:8443/osg/UNICA-PUSH-REST");

//Disable SSL validation
$pushClient->CertificateValidation(0);

//Set up mandatory parameters
$address["phoneNumber"]="525515385391";
$created = date("Y-m-d\\TH:i:s");
$text = "This is the Message";

//Send wap push message
$result =  $pushClient->sendPushMessage($address,$created,$text);

//Checking response
$protocol=explode (":",strtolower($result));
if ($protocol == 'http' || $protocol == 'https'){
            //Getting Delivery Status
            $deliveryStatus =  $pushClient->getPushMessageDeliveryStatus($result); 
            echo $deliveryStatus;
    }
else {
        //An error ocurred
        echo $result;    
        }

?>

